<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
	pageEncoding="ISO-8859-1"%>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>
<%@ taglib prefix="core" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@ page import="mytask.domain.AuthManager"%>
<%@ page import="mytask.model.ProjectStatus"%>

<%@ include file="../components/screenHeader.jspf"%>

<div class="ButtonsContainerTop">
	<a href="<spring:url value="/projects/add" />" class="EditButton">Lisa uus projekt</a>
</div>

<table class="align-center ProjectList">
<thead>
	<tr>
		<th width="60%">Nimi</th>
		<th width="14%">Olek</th>
		<th width="10%">Liikmeid</th>
		<th width="16%">Viimati muudetud</th>
	</tr>
</thead>
<tbody>
<core:forEach var="project" items="${projects}">
	<spring:url value="/projects/view?id=${project.id}" var="projectLink"></spring:url>
	<tr>
		<td><a href="${projectLink}">${project.title}</a></td>
		<td class="ProjectStatus${project.status}">
		<core:choose>
			<core:when test="${project.status == 'ACTIVE'}">
				<%=ProjectStatus.ACTIVE.toString()%>
			</core:when>
			<core:when test="${project.status == 'ARCHIVED'}">
				<%=ProjectStatus.ARCHIVED.toString()%>
			</core:when>
		</core:choose>
		</td>
		<td align="center">${fn:length(project.members)}</td>
		<td><fmt:formatDate pattern="dd.MM.yyyy HH:mm:ss" value="${project.lastModified}"/></td>
	</tr>
</core:forEach>	
</tbody>
</table>

<%@ include file="../components/screenFooter.jspf"%>